package cn.net.gemai.springboot_properties.entity;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @Value方式 读取application.properties配置文件
 */
@Component
//@PropertySource(value = {"classpath:application.properties"}, encoding = "utf-8")
public class ApplicationProperties {
    /**
     * 将配置文件名称与属性字段绑定
     * 绑定的属性字段可以单独使用，也可以集中放到一个class中管理
     */
    @Value("${demo.name}")
    private String name;

    @Value("${demo.age}")
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
